import {login} from "../../api/loginApi";

export async function loginUserAction(user) {
    const data = await login(user)
    if (data.code === '200') {
        return {
            code: '200',
            type: 'LOGIN',
            data: data.data
        }
    } else {
        return {
            code: '999',
            type: null,
            ...data
        }
    }
}


export function demo() {
    return {
        type: 'DEMO'
    }

}

export function editUserActions(data) {
    return {
        type: 'EDITUSER',
        data: data
    }
}

export function logOutSystem() {
    return {
        type: 'LOGOUT'
    }
}
